home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Mac OS / UPDATE- Int&Libs 3.2 / AIncludes / URLAccess.a < prev   
Encoding:
Text File  |  1999-05-25  |  7.9 KB  |  279 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        URLAccess.a
  3. ;
  4. ;    Contains:    URL Access Interfaces.
  5. ;
  6. ;    Version:    Technology:    1.0
  7. ;                Release:    Veronica Seed, Use with 3.2 Universal Interfaces
  8. ;
  9. ;    Copyright:    © 1994-1999 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__URLACCESS__') = 'UNDEFINED' THEN
  18. __URLACCESS__ SET 1
  19.  
  20.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  21.     include 'Types.a'
  22.     ENDIF
  23.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  24.     include 'Files.a'
  25.     ENDIF
  26.     IF &TYPE('__CODEFRAGMENTS__') = 'UNDEFINED' THEN
  27.     include 'CodeFragments.a'
  28.     ENDIF
  29.  
  30. ;  Data structures and types 
  31.  
  32.  
  33.  
  34.  
  35. kURLReplaceExistingFlag            EQU        $01
  36. kURLBinHexFileFlag                EQU        $02                    ; Binhex before uploading if necessary
  37. kURLExpandFileFlag                EQU        $04                    ; Use StuffIt engine to expand file if necessary
  38. kURLDisplayProgressFlag            EQU        $08
  39. kURLDisplayAuthFlag                EQU        $10                    ; Display auth dialog if guest connection fails
  40. kURLUploadFlag                    EQU        $20                    ; Do an upload instead of a download
  41. kURLIsDirectoryHintFlag            EQU        $40                    ; Hint: the URL is a directory
  42. kURLDoNotTryAnonymousFlag        EQU        $80                    ; Don't try to connect anonymously before getting logon info
  43. kURLDirectoryListingFlag        EQU        $0100                ; Download the directory listing, not the whole directory
  44. kURLReservedFlag                EQU        $80000000            ; reserved for Apple internal use
  45. ; typedef UInt32                         URLOpenFlags
  46.  
  47.  
  48. kURLNullState                    EQU        0
  49. kURLInitiatingState                EQU        1
  50. kURLLookingUpHostState            EQU        2                    ; NOT IN EXT HEADER
  51. kURLConnectingState                EQU        3                    ; NOT IN EXT HEADER
  52. kURLResourceFoundState            EQU        4
  53. kURLDownloadingState            EQU        5
  54. kURLDataAvailableState            EQU        $15
  55. kURLTransactionCompleteState    EQU        6
  56. kURLErrorOccurredState            EQU        7
  57. kURLAbortingState                EQU        8
  58. kURLCompletedState                EQU        9
  59. kURLUploadingState                EQU        10
  60. ; typedef UInt32                         URLState
  61.  
  62.  
  63. kURLInitiatedEvent                EQU        1
  64. kURLResourceFoundEvent            EQU        4
  65. kURLDownloadingEvent            EQU        5
  66. kURLAbortInitiatedEvent            EQU        8
  67. kURLCompletedEvent                EQU        9
  68. kURLErrorOccurredEvent            EQU        7
  69. kURLDataAvailableEvent            EQU        $15
  70. kURLTransactionCompleteEvent    EQU        6
  71. kURLUploadingEvent                EQU        10
  72. kURLSystemEvent                    EQU        29
  73. kURLPercentEvent                EQU        30
  74. kURLPeriodicEvent                EQU        31
  75. kURLPropertyChangedEvent        EQU        32
  76. ; typedef UInt32                         URLEvent
  77.  
  78.  
  79. kURLInitiatedEventMask            EQU        $01
  80. kURLResourceFoundEventMask        EQU        $08
  81. kURLDownloadingMask                EQU        $10
  82. kURLUploadingMask                EQU        $0200
  83. kURLAbortInitiatedMask            EQU        $80
  84. kURLCompletedEventMask            EQU        $0100
  85. kURLErrorOccurredEventMask        EQU        $40
  86. kURLDataAvailableEventMask        EQU        $00100000
  87. kURLTransactionCompleteEventMask EQU    $20
  88. kURLSystemEventMask                EQU        $10000000
  89. kURLPercentEventMask            EQU        $20000000
  90. kURLPeriodicEventMask            EQU        $40000000
  91. kURLPropertyChangedEventMask    EQU        $80000000
  92. kURLAllBufferEventsMask            EQU        $00100020
  93. kURLAllNonBufferEventsMask        EQU        $E00003D1
  94. kURLAllEventsMask                EQU        $FFFFFFFF
  95. ; typedef UInt32                         URLEventMask
  96.  
  97. URLCallbackInfo            RECORD 0
  98. version                     ds.l    1                ; offset: $0 (0)
  99. urlRef                     ds.l    1                ; offset: $4 (4)
  100. property                 ds.l    1                ; offset: $8 (8)
  101. currentSize                 ds.l    1                ; offset: $C (12)
  102. systemEvent                 ds.l    1                ; offset: $10 (16)
  103. sizeof                     EQU *                    ; size:   $14 (20)
  104.                         ENDR
  105. ;  http and https properties
  106. ;  authentication type flags
  107.  
  108. kUserNameAndPasswordFlag        EQU        $00000001
  109. ;
  110. ; pascal OSStatus URLGetURLAccessVersion(UInt32 *returnVers)
  111. ;
  112.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  113.         IMPORT_CFM_FUNCTION URLGetURLAccessVersion
  114.     ENDIF
  115.  
  116.     IF TARGET_RT_MAC_CFM THEN
  117. ;        URLAccessAvailable() is a macro/inline available only in C/C++.  
  118. ;        To get the same functionality from pascal or assembly, you need
  119. ;        to test if URLGetURLAccessVersion function is not NULL.  For instance:
  120. ;        
  121. ;            gURLAccessAvailable = FALSE;
  122. ;            IF @URLAccessAvailable <> kUnresolvedCFragSymbolAddress THEN
  123. ;                gURLAccessAvailable = TRUE;
  124. ;            END
  125. ;    
  126. ;    
  127.  
  128.     ENDIF    ; TARGET_RT_MAC_CFM
  129. ;
  130. ; pascal OSStatus URLSimpleDownload(const char *url, FSSpec *destination, Handle destinationHandle, URLOpenFlags openFlags, URLSystemEventProcPtr eventProc, void *userContext)
  131. ;
  132.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  133.         IMPORT_CFM_FUNCTION URLSimpleDownload
  134.     ENDIF
  135.  
  136. ;
  137. ; pascal OSStatus URLDownload(URLReference urlRef, FSSpec *destination, Handle destinationHandle, URLOpenFlags openFlags, URLSystemEventProcPtr eventProc, void *userContext)
  138. ;
  139.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  140.         IMPORT_CFM_FUNCTION URLDownload
  141.     ENDIF
  142.  
  143. ;
  144. ; pascal OSStatus URLSimpleUpload(const char *url, const FSSpec *source, URLOpenFlags openFlags, URLSystemEventProcPtr eventProc, void *userContext)
  145. ;
  146.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  147.         IMPORT_CFM_FUNCTION URLSimpleUpload
  148.     ENDIF
  149.  
  150. ;
  151. ; pascal OSStatus URLUpload(URLReference urlRef, const FSSpec *source, URLOpenFlags openFlags, URLSystemEventProcPtr eventProc, void *userContext)
  152. ;
  153.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  154.         IMPORT_CFM_FUNCTION URLUpload
  155.     ENDIF
  156.  
  157. ;
  158. ; pascal OSStatus URLNewReference(const char *url, URLReference *urlRef)
  159. ;
  160.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  161.         IMPORT_CFM_FUNCTION URLNewReference
  162.     ENDIF
  163.  
  164. ;
  165. ; pascal OSStatus URLDisposeReference(URLReference urlRef)
  166. ;
  167.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  168.         IMPORT_CFM_FUNCTION URLDisposeReference
  169.     ENDIF
  170.  
  171. ;
  172. ; pascal OSStatus URLOpen(URLReference urlRef, FSSpec *fileSpec, URLOpenFlags openFlags, URLNotifyProcPtr notifyProc, URLEventMask eventRegister, void *userContext)
  173. ;
  174.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  175.         IMPORT_CFM_FUNCTION URLOpen
  176.     ENDIF
  177.  
  178. ;
  179. ; pascal OSStatus URLAbort(URLReference urlRef)
  180. ;
  181.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  182.         IMPORT_CFM_FUNCTION URLAbort
  183.     ENDIF
  184.  
  185. ;
  186. ; pascal OSStatus URLGetDataAvailable(URLReference urlRef, Size *dataSize)
  187. ;
  188.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  189.         IMPORT_CFM_FUNCTION URLGetDataAvailable
  190.     ENDIF
  191.  
  192. ;
  193. ; pascal OSStatus URLGetBuffer(URLReference urlRef, void **buffer, Size *bufferSize)
  194. ;
  195.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  196.         IMPORT_CFM_FUNCTION URLGetBuffer
  197.     ENDIF
  198.  
  199. ;
  200. ; pascal OSStatus URLReleaseBuffer(URLReference urlRef, void *buffer)
  201. ;
  202.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  203.         IMPORT_CFM_FUNCTION URLReleaseBuffer
  204.     ENDIF
  205.  
  206. ;
  207. ; pascal OSStatus URLGetProperty(URLReference urlRef, const char *property, void *propertyBuffer, Size bufferSize)
  208. ;
  209.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  210.         IMPORT_CFM_FUNCTION URLGetProperty
  211.     ENDIF
  212.  
  213. ;
  214. ; pascal OSStatus URLGetPropertySize(URLReference urlRef, const char *property, Size *propertySize)
  215. ;
  216.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  217.         IMPORT_CFM_FUNCTION URLGetPropertySize
  218.     ENDIF
  219.  
  220. ;
  221. ; pascal OSStatus URLSetProperty(URLReference urlRef, const char *property, void *propertyBuffer, Size bufferSize)
  222. ;
  223.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  224.         IMPORT_CFM_FUNCTION URLSetProperty
  225.     ENDIF
  226.  
  227. ;
  228. ; pascal OSStatus URLGetCurrentState(URLReference urlRef, URLState *state)
  229. ;
  230.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  231.         IMPORT_CFM_FUNCTION URLGetCurrentState
  232.     ENDIF
  233.  
  234. ;
  235. ; pascal OSStatus URLGetError(URLReference urlRef, OSStatus *urlError)
  236. ;
  237.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  238.         IMPORT_CFM_FUNCTION URLGetError
  239.     ENDIF
  240.  
  241.  
  242. ;
  243. ; pascal OSStatus URLIdle(void)
  244. ;
  245.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  246.         IMPORT_CFM_FUNCTION URLIdle
  247.     ENDIF
  248.  
  249. ;
  250. ; pascal OSStatus URLGetFileInfo(StringPtr fName, OSType *fType, OSType *fCreator)
  251. ;
  252.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  253.         IMPORT_CFM_FUNCTION URLGetFileInfo
  254.     ENDIF
  255.  
  256.  
  257. ;  Error Codes 
  258.  
  259. kURLInternetAccessErrorCodeBase    EQU        -30770
  260. kURLInvalidURLReferenceError    EQU        -30770
  261. kURLProgressAlreadyDisplayedError EQU    -30771
  262. kURLDestinationExistsError        EQU        -30772
  263. kURLInvalidURLError                EQU        -30773
  264. kURLUnsupportedSchemeError        EQU        -30774
  265. kURLServerBusyError                EQU        -30775
  266. kURLAuthenticationError            EQU        -30776
  267. kURLPropertyNotYetKnownError    EQU        -30777
  268. kURLUnknownPropertyError        EQU        -30778
  269. kURLPropertyBufferTooSmallError    EQU        -30779
  270. kURLUnsettablePropertyError        EQU        -30780
  271. kURLInvalidCallError            EQU        -30781
  272. kURLFileEmptyError                EQU        -30783
  273. kURLExtensionFailureError        EQU        -30785
  274. kURLInvalidConfigurationError    EQU        -30786
  275. kURLAccessNotAvailableError        EQU        -30787
  276.     ENDIF ; __URLACCESS__ 
  277.  
  278.